﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using myUserManagement;

namespace POS
{
    public partial class frmChangePassword : Form
    {
        frmMain parent;
        ghieUserManagement ghieUser = new ghieUserManagement();   
        public frmChangePassword(frmMain p)
        {
            parent = p;
            InitializeComponent();
            btnchange.Click += new EventHandler(btnchange_Click);
        }

        void btnchange_Click(object sender, EventArgs e)
        {
            ghieUser.connection();
            ghieUser.UpdatePassword("Update userdb.tbluser set  fPassword ='" + this.txtnewpass.Text + "' where fPassword='" + this.txtOldpass.Text + "';");
            MessageBox.Show("Password Changed", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            ghieUser.DBClose();
            clearing();
        }

        void clearing()
        {
            txtconfirm.Clear();
            txtnewpass.Clear();
            txtOldpass.Clear();


        }
    }
}
